// characters模板
class Music{
    // 传入mongoose对象
    constructor(mongoose){
        this.mongoose = mongoose
        this.Schema = mongoose.Schema  
        // CharactersInfo
        this.CoserInfo = new this.Schema({
            id:Number,
            img_url:String,
            productor:String,
            priaseNumber:Number,
            commentNumber:Number,
            priasePeople:Array    
        })
        this.modal = this.mongoose.model('Coser',this.CoserInfo)
    }
    // 返回查询结果
    CoserInfoFind(){
        return this.modal.aggregate([{ $sample:{  size : 4  }}] ,(err,data)=>{
            if (err) {console.log(err)}
            else{ return data }
        })
    }
}

module.exports = Music